package xyz.scootaloo.alg.tool

/**
 * @author flutterdash@qq.com
 * @since 2021/5/4 8:05
 */

open class ConfigItem<T>(
    val key: String,
    protected var value: T
) {
    infix fun set(value: T) {
        this.value = value
    }
}

open class ConfigMenu(key: String) : ConfigItem<MutableList<ConfigItem<Any>>>(key, ArrayList()) {
//    fun <T> addConfigItem(item: ConfigItem<T>): ConfigItem<T> {
//        for (confItem in value) {
//            if (confItem.key == item.key)
//                return confItem
//        }
////        this.value.add(item)
//    }
}

class StringConfigItem(key: String) : ConfigItem<String>(key, "")
class ByteConfigItem(key: String) : ConfigItem<Byte>(key, 0)
class ShortConfigItem(key: String) : ConfigItem<Short>(key, 0)
class IntConfigItem(key: String) : ConfigItem<Int>(key, 0)
class LongConfigItem(key: String) : ConfigItem<Long>(key, 0)
class FloatConfigItem(key: String) : ConfigItem<Float>(key, 0f)
class DoubleConfigItem(key: String) : ConfigItem<Double>(key, 0.0)
class BooleanConfigItem(key: String) : ConfigItem<Boolean>(key, false)

// demo

class ConfigDemo : ConfigMenu("*") {

}
